package com.fc.test.service;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.fc.test.common.base.BaseService;
import com.fc.test.common.support.Convert;
import com.fc.test.mapper.auto.TAbbTjbannerMapper;
import com.fc.test.model.auto.TAbbTjbanner;
import com.fc.test.model.auto.TAbbTjbannerExample;
import com.fc.test.model.custom.Tablepar;
import com.fc.test.util.SnowflakeIdWorker;

/**
 * Service
* @Title: TAbbTjbannerService.java 
* @Package com.fc.test.entity 
* @author fuce
* @email 87766867@qq.com
* @date 2019-08-13 15:32:24  
 */
@Service
public class TAbbTjbannerService implements BaseService<TAbbTjbanner, TAbbTjbannerExample>{
	@Autowired
	private TAbbTjbannerMapper tAbbTjbannerMapper;
	
	/**
	 * 分页查询
	 * @param pageNum
	 * @param pageSize
	 * @return
	 */
	 public PageInfo<TAbbTjbanner> list(Tablepar tablepar){
	        TAbbTjbannerExample testExample=new TAbbTjbannerExample();
	        testExample.setOrderByClause("id ASC");
	        PageHelper.startPage(tablepar.getPageNum(), tablepar.getPageSize());
	        List<TAbbTjbanner> list= tAbbTjbannerMapper.selectByExample(testExample);
	        PageInfo<TAbbTjbanner> pageInfo = new PageInfo<TAbbTjbanner>(list);
	        return  pageInfo;
	 }

	@Override
	public int deleteByPrimaryKey(String ids) {
		List<String> lista=Convert.toListStrArray(ids);
		TAbbTjbannerExample example=new TAbbTjbannerExample();
		example.createCriteria().andIdIn(lista);
		return tAbbTjbannerMapper.deleteByExample(example);
	}
	
	
	@Override
	public TAbbTjbanner selectByPrimaryKey(String id) {
		
		return tAbbTjbannerMapper.selectByPrimaryKey(id);
	}

	
	@Override
	public int updateByPrimaryKeySelective(TAbbTjbanner record) {
		return tAbbTjbannerMapper.updateByPrimaryKeySelective(record);
	}
	
	/**
	 * 添加
	 */
	@Override
	public int insertSelective(TAbbTjbanner record) {
		//添加雪花主键id
		record.setId(SnowflakeIdWorker.getUUID());
		return tAbbTjbannerMapper.insertSelective(record);
	}
	
	

	

	
	
	

	
	@Override
	public int updateByExampleSelective(TAbbTjbanner record, TAbbTjbannerExample example) {
		
		return tAbbTjbannerMapper.updateByExampleSelective(record, example);
	}

	
	@Override
	public int updateByExample(TAbbTjbanner record, TAbbTjbannerExample example) {
		
		return tAbbTjbannerMapper.updateByExample(record, example);
	}

	@Override
	public List<TAbbTjbanner> selectByExample(TAbbTjbannerExample example) {
		
		return tAbbTjbannerMapper.selectByExample(example);
	}

	
	@Override
	public long countByExample(TAbbTjbannerExample example) {
		
		return tAbbTjbannerMapper.countByExample(example);
	}

	
	@Override
	public int deleteByExample(TAbbTjbannerExample example) {
		
		return tAbbTjbannerMapper.deleteByExample(example);
	}
	


}
